package com.globagames.strategicgames.business
{
	import com.globagames.strategicgames.model.StrategicGameModelLocator;
	
	import mx.messaging.Producer;
	import mx.messaging.events.MessageAckEvent;
	import mx.messaging.events.MessageFaultEvent;
	import mx.messaging.messages.AsyncMessage;
	
	public class ConnectProducer extends Producer
	{
		
		private var model:StrategicGameModelLocator = StrategicGameModelLocator.getInstance();
	
	
		public function ConnectProducer(playerId:int)
		{
			destination = "connectMessages";
			subtopic = ""+playerId;
			trace("subtopic="+subtopic);
			//addEventListener(MessageAckEvent.ACKNOWLEDGE, acknowledgeHandler);
			addEventListener(MessageFaultEvent.FAULT, faultHandler);
		}
		public function acknowledgeHandler(event:MessageAckEvent) :void
		{
			trace("acknowledgeHandler");
		}
		public function faultHandler(event:MessageFaultEvent)
		{
			trace("faultHandler");
		}
		public function sendMessage(msg:String):void {
			var message:AsyncMessage = new AsyncMessage();
			message.body = msg;
			send(message);
		}

	}
}